<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>couchdbkit.ext.django.forms</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="couchdbkit-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="couchdbkit-module.html">Package&nbsp;couchdbkit</a> ::
        <a href="couchdbkit.ext-module.html">Package&nbsp;ext</a> ::
        <a href="couchdbkit.ext.django-module.html">Package&nbsp;django</a> ::
        Module&nbsp;forms
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="couchdbkit.ext.django.forms-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module forms</h1><p class="nomargin-top"><span class="codelink"><a href="couchdbkit.ext.django.forms-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">
Implement DocumentForm object. It map Document objects to Form and 
works like ModelForm object :

    &gt;&gt;&gt; from couchdbkit.ext.django.forms  import DocumentForm

    # Create the form class.
    &gt;&gt;&gt; class ArticleForm(DocumentForm):
    ...     class Meta:
    ...         model = Article

    # Creating a form to add an article.
    &gt;&gt;&gt; form = ArticleForm()

    # Creating a form to change an existing article.
    &gt;&gt;&gt; article = Article.get(someid)
    &gt;&gt;&gt; form = ArticleForm(instance=article)
    

The generated Form class will have a form field for every model field. 
Each document property has a corresponding default form field:

* StringProperty   -&gt;  CharField,
* IntegerProperty  -&gt;  IntegerField,
* DecimalProperty  -&gt;  DecimalField,
* BooleanProperty  -&gt;  BooleanField,
* FloatProperty    -&gt;  FloatField,
* DateTimeProperty -&gt;  DateTimeField,
* DateProperty     -&gt;  DateField,
* TimeProperty     -&gt;  TimeField


More fields types will be supported soon.

</pre>

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="couchdbkit.ext.django.forms.DocumentFormOptions-class.html" class="summary-name">DocumentFormOptions</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="couchdbkit.ext.django.forms.DocumentFormMetaClass-class.html" class="summary-name">DocumentFormMetaClass</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="couchdbkit.ext.django.forms.BaseDocumentForm-class.html" class="summary-name">BaseDocumentForm</a><br />
      Base Document Form object
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="couchdbkit.ext.django.forms.DocumentForm-class.html" class="summary-name">DocumentForm</a><br />
      The document form object
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="couchdbkit.ext.django.forms-module.html#document_to_dict" class="summary-sig-name">document_to_dict</a>(<span class="summary-sig-arg">instance</span>,
        <span class="summary-sig-arg">properties</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">exclude</span>=<span class="summary-sig-default">None</span>)</span><br />
      Returns a dict containing the data in ``instance`` suitable for 
      passing as a Form's ``initial`` keyword argument.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="couchdbkit.ext.django.forms-pysrc.html#document_to_dict">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="couchdbkit.ext.django.forms-module.html#fields_for_document" class="summary-sig-name">fields_for_document</a>(<span class="summary-sig-arg">document</span>,
        <span class="summary-sig-arg">properties</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">exclude</span>=<span class="summary-sig-default">None</span>)</span><br />
      Returns a ``SortedDict`` containing form fields for the given 
      document.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="couchdbkit.ext.django.forms-pysrc.html#fields_for_document">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="couchdbkit.ext.django.forms-module.html#FIELDS_PROPERTES_MAPPING" class="summary-name">FIELDS_PROPERTES_MAPPING</a> = <code title="{'BooleanProperty': &lt;class 'django.forms.fields.BooleanField'&gt;,
 'DateProperty': &lt;class 'django.forms.fields.DateField'&gt;,
 'DateTimeProperty': &lt;class 'django.forms.fields.DateTimeField'&gt;,
 'DecimalProperty': &lt;class 'django.forms.fields.DecimalField'&gt;,
 'FloatProperty': &lt;class 'django.forms.fields.FloatField'&gt;,
 'IntegerProperty': &lt;class 'django.forms.fields.IntegerField'&gt;,
 'StringProperty': &lt;class 'django.forms.fields.CharField'&gt;,
 'TimeProperty': &lt;class 'django.forms.fields.TimeField'&gt;}"><code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">BooleanProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.<code class="variable-ellipsis">...</code></code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'couchdbkit.ext.django'"><code class="variable-quote">'</code><code class="variable-string">couchdbkit.ext.django</code><code class="variable-quote">'</code></code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="document_to_dict"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">document_to_dict</span>(<span class="sig-arg">instance</span>,
        <span class="sig-arg">properties</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">exclude</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="couchdbkit.ext.django.forms-pysrc.html#document_to_dict">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Returns a dict containing the data in ``instance`` suitable for 
  passing as a Form's ``initial`` keyword argument.</p>
  <p>``properties`` is an optional list of properties names. If provided, 
  only the named properties will be included in the returned dict.</p>
  <p>``exclude`` is an optional list of properties names. If provided, the 
  named properties will be excluded from the returned dict, even if they 
  are listed in the ``properties`` argument.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="fields_for_document"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">fields_for_document</span>(<span class="sig-arg">document</span>,
        <span class="sig-arg">properties</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">exclude</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="couchdbkit.ext.django.forms-pysrc.html#fields_for_document">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Returns a ``SortedDict`` containing form fields for the given 
  document.</p>
  <p>``properties`` is an optional list of properties names. If provided, 
  only the named properties will be included in the returned 
  properties.</p>
  <p>``exclude`` is an optional list of properties names. If provided, the 
  named properties will be excluded from the returned properties, even if 
  they are listed in the ``properties`` argument.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== VARIABLES DETAILS ==================== -->
<a name="section-VariablesDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-VariablesDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="FIELDS_PROPERTES_MAPPING"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">FIELDS_PROPERTES_MAPPING</h3>
  
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
<code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">BooleanProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.forms.fields.BooleanField'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">DateProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.forms.fields.DateField'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">DateTimeProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.forms.fields.DateTimeField'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">DecimalProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.forms.fields.DecimalField'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">FloatProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.forms.fields.FloatField'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">IntegerProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.forms.fields.IntegerField'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">StringProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.forms.fields.CharField'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">TimeProperty</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'django.forms.fields.TimeField'&gt;<code class="variable-group">}</code>
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="couchdbkit-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Fri May  4 11:48:40 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
